data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1204.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0543 -0.3068 -0.0716 0.1949 6.2956
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000001883 0.001372
## Residual 0.000012744 0.003570
## Number of obs: 178, groups: stateID, 33
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0122143040 0.0097856419 76.1043940014
## Affluence 0.0047067502 0.0011081056 112.1024549167
## Singletons.in.Tract 0.0007816757 0.0008973067 148.1007623173
## Seniors.in.Tract 0.0005433391 0.0011808434 154.5346227933
## African.Americans.in.Tract 0.0009970831 0.0009862300 155.3576126389
## Noncitizens.in.Tract 0.0009621312 0.0007643654 129.1214899898
## High.BP 0.0001896513 0.0001876928 119.8244080119
## Binge.Drinking 0.0001757468 0.0001606959 49.0494202896
## Cancer -0.0012147384 0.0011060181 112.0213097301
## Asthma 0.0008260257 0.0005721362 53.9918785984
## Heart.Disease 0.0016751064 0.0013132952 84.5149564622
## COPD -0.0003199412 0.0010931237 83.8551038978
## Smoking -0.0000256067 0.0002278597 89.9936942637
## Diabetes -0.0006666581 0.0005367303 89.0741347081
## No.Physical.Activity -0.0000691120 0.0002066629 98.2361195842
## Obesity 0.0002817590 0.0001767625 119.3793978661
## Poor.Sleeping.Habits -0.0000553327 0.0001645576 130.5553831619
## Poor.Mental.Health -0.0000865825 0.0004335174 34.9627004371
## Testing_Rate 0.0000006762 0.0000002810 44.8879829548
## Hospitalization_Rate -0.0000575238 0.0000937872 31.3583542101
## t value Pr(>|t|)
## (Intercept) -1.248 0.2158
## Affluence 4.248 0.0000448 ***
## Singletons.in.Tract 0.871 0.3851
## Seniors.in.Tract 0.460 0.6461
## African.Americans.in.Tract 1.011 0.3136
## Noncitizens.in.Tract 1.259 0.2104
## High.BP 1.010 0.3143
## Binge.Drinking 1.094 0.2794
## Cancer -1.098 0.2744
## Asthma 1.444 0.1546
## Heart.Disease 1.275 0.2056
## COPD -0.293 0.7705
## Smoking -0.112 0.9108
## Diabetes -1.242 0.2175
## No.Physical.Activity -0.334 0.7388
## Obesity 1.594 0.1136
## Poor.Sleeping.Habits -0.336 0.7372
## Poor.Mental.Health -0.200 0.8429
## Testing_Rate 2.406 0.0203 *
## Hospitalization_Rate -0.613 0.5441
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.105
## Sngltns.n.T 0.030 0.070
## Snrs.n.Trct 0.546 0.385 0.196
## Afrcn.Am..T 0.146 0.156 -0.401 0.147
## Nnctzns.n.T -0.007 0.100 0.036 0.063 -0.085
## High.BP -0.023 0.244 0.056 0.106 -0.087 0.388
## Bing.Drnkng -0.307 -0.174 -0.293 -0.169 0.072 0.027 0.124
## Cancer -0.591 -0.183 0.179 -0.317 -0.071 -0.132 -0.361 -0.090
## Asthma -0.403 -0.197 -0.254 -0.214 0.086 0.094 0.168 0.005 0.071
## Heart.Dises -0.155 0.080 -0.300 -0.156 0.249 -0.106 -0.002 0.057 -0.469
## COPD 0.576 0.025 0.155 0.280 -0.022 0.275 0.154 0.086 -0.280
## Smoking -0.142 0.146 -0.174 -0.103 -0.049 0.015 -0.061 -0.302 0.076
## Diabetes 0.101 -0.350 -0.102 -0.217 -0.305 -0.310 -0.534 0.049 0.232
## N.Physcl.Ac -0.199 -0.033 0.079 -0.028 -0.032 -0.226 -0.087 0.120 0.473
## Obesity 0.004 0.414 0.434 0.302 0.135 0.188 -0.093 -0.228 0.104
## Pr.Slpng.Hb -0.444 -0.389 0.137 -0.354 -0.339 -0.032 -0.187 0.099 0.138
## Pr.Mntl.Hlt -0.352 0.268 -0.067 -0.048 0.098 -0.163 -0.052 0.088 0.330
## Testing_Rat 0.247 -0.085 0.014 0.039 0.021 -0.054 -0.039 -0.030 -0.214
## Hsptlztn_Rt -0.119 -0.237 -0.097 -0.227 -0.062 -0.078 -0.108 -0.131 0.021
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.279
## COPD -0.391 -0.563
## Smoking 0.081 0.207 -0.499
## Diabetes -0.129 -0.304 -0.075 0.224
## N.Physcl.Ac 0.025 -0.375 -0.018 -0.329 -0.084
## Obesity -0.266 -0.092 0.162 -0.198 -0.382 -0.062
## Pr.Slpng.Hb 0.078 0.248 -0.193 -0.029 -0.022 -0.102 -0.166
## Pr.Mntl.Hlt -0.220 0.087 -0.456 0.067 0.009 0.059 0.077 -0.166
## Testing_Rat -0.359 -0.040 0.224 0.144 0.130 -0.309 0.123 -0.151 -0.158
## Hsptlztn_Rt 0.096 0.103 -0.104 0.093 0.065 -0.049 -0.028 -0.013 -0.104
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.190
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2469.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6574 -0.3658 -0.0699 0.2437 6.8909
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000007101 0.002665
## Residual 0.000011517 0.003394
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -0.02128652 0.00764922 194.73091984 -2.783
## Affluence 0.00278248 0.00069323 302.79470992 4.014
## Singletons.in.Tract 0.00083404 0.00064675 300.78502968 1.290
## Seniors.in.Tract 0.00040138 0.00081700 304.40203255 0.491
## African.Americans.in.Tract 0.00163376 0.00078982 306.69369543 2.069
## Noncitizens.in.Tract 0.00167676 0.00063795 273.23086687 2.628
## High.BP -0.00001987 0.00014306 299.51338361 -0.139
## Binge.Drinking 0.00037147 0.00015067 161.65234891 2.465
## Cancer -0.00032625 0.00083964 268.01984750 -0.389
## Asthma 0.00064276 0.00049958 143.58592002 1.287
## Heart.Disease 0.00295350 0.00107807 213.93927257 2.740
## COPD -0.00117572 0.00081617 208.22445052 -1.441
## Smoking -0.00022429 0.00018855 253.53405078 -1.190
## Diabetes -0.00109435 0.00040396 270.81616864 -2.709
## No.Physical.Activity 0.00029795 0.00016233 240.06491995 1.835
## Obesity 0.00022427 0.00013125 307.92946098 1.709
## Poor.Sleeping.Habits 0.00025333 0.00012644 297.82938348 2.003
## Poor.Mental.Health -0.00013789 0.00042424 105.02124871 -0.325
## Pr(>|t|)
## (Intercept) 0.00592 **
## Affluence 0.0000754 ***
## Singletons.in.Tract 0.19818
## Seniors.in.Tract 0.62358
## African.Americans.in.Tract 0.03943 *
## Noncitizens.in.Tract 0.00906 **
## High.BP 0.88965
## Binge.Drinking 0.01473 *
## Cancer 0.69791
## Asthma 0.20030
## Heart.Disease 0.00667 **
## COPD 0.15122
## Smoking 0.23532
## Diabetes 0.00718 **
## No.Physical.Activity 0.06768 .
## Obesity 0.08850 .
## Poor.Sleeping.Habits 0.04603 *
## Poor.Mental.Health 0.74580
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence -0.052
## Sngltns.n.T -0.055 0.043
## Snrs.n.Trct 0.393 0.293 0.073
## Afrcn.Am..T 0.241 0.076 -0.404 0.202
## Nnctzns.n.T -0.072 0.153 0.125 0.058 -0.191
## High.BP -0.094 0.158 0.098 0.008 -0.232 0.326
## Bing.Drnkng -0.490 -0.038 -0.205 -0.067 0.041 -0.076 0.148
## Cancer -0.494 -0.095 0.231 -0.171 -0.074 -0.066 -0.330 -0.018
## Asthma -0.270 -0.095 -0.262 -0.122 -0.015 0.212 0.051 0.009 -0.157
## Heart.Dises -0.059 0.078 -0.301 -0.132 0.213 -0.055 0.001 0.034 -0.603
## COPD 0.479 0.008 0.129 0.171 -0.006 0.156 0.057 0.059 -0.212
## Smoking -0.042 0.105 -0.119 -0.138 -0.104 0.159 -0.082 -0.327 0.156
## Diabetes 0.036 -0.302 -0.078 -0.132 -0.230 -0.251 -0.447 0.074 0.369
## N.Physcl.Ac -0.116 0.035 0.102 0.079 0.059 -0.275 0.004 0.127 0.335
## Obesity -0.066 0.382 0.398 0.201 0.133 0.193 -0.103 -0.146 0.118
## Pr.Slpng.Hb -0.385 -0.350 0.162 -0.325 -0.321 -0.046 -0.156 0.087 0.028
## Pr.Mntl.Hlt -0.353 0.184 -0.008 0.024 0.052 -0.164 0.029 0.130 0.416
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.335
## COPD -0.321 -0.492
## Smoking 0.144 0.084 -0.475
## Diabetes -0.106 -0.434 -0.006 0.277
## N.Physcl.Ac -0.022 -0.359 0.088 -0.274 -0.168
## Obesity -0.125 -0.021 0.091 -0.220 -0.375 -0.044
## Pr.Slpng.Hb 0.000 0.239 -0.092 -0.169 -0.061 -0.153 -0.115
## Pr.Mntl.Hlt -0.438 -0.065 -0.390 -0.029 0.071 -0.087 0.024 -0.080
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)